package com.zf.shuashua.advert.mg;

import android.app.Activity

class MangoProvider : BaseAdProvider() {

    private val TAG = "MangoProvider"

    override fun isBelongTheProvider(adObject: Any): Boolean {
        return false
    }

    private var mangoReward: MangoReward? = null
    override fun requestRewardAd(activity: Activity, adProviderType: String, alias: String, listener: RewardListener) {
        callbackRewardStartRequest(adProviderType, listener)

        mangoReward = MangoReward(activity, object : MGRewardListener {
            override fun onClick() {
                callbackRewardClicked(adProviderType, listener)
            }

            override fun onExpose() {
                callbackRewardShow(adProviderType, listener)
                callbackRewardExpose(adProviderType, listener)
            }

            override fun onLoaded() {
                callbackRewardLoaded(adProviderType, listener)
                callbackRewardVideoCached(adProviderType, listener)
            }

            override fun onVideoComplete() {
                callbackRewardVideoComplete(adProviderType, listener)
                callbackRewardVerify(adProviderType, listener)
            }

            override fun onError(errorMsg: String?) {
                callbackRewardFailed(adProviderType, listener, errorMsg)
            }

            override fun onClose() {
                callbackRewardClose(adProviderType, listener)
            }
        })
        mangoReward?.load()
    }

    override fun showRewardAd(activity: Activity) {
        mangoReward?.show()
    }

}